package com.ruoyi.system.controller;

import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/system/capital")
public class CapitalController extends BaseController {
    private String prefix = "system/capital";

    @Autowired
    private ISysUserService sysUserService;

    @GetMapping("capital")
    public String capital(ModelMap mmap) {
        Long userId = getSysUser().getUserId();

        // 这里需要重新查询，需要获得数据库的实时余额
        SysUser user = sysUserService.selectUserById(userId);
        mmap.put("user", user);
        return prefix + "/capital";
    }
}
